<template>
  <div class="app-container">

    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
      <el-form-item label="商户类型" prop="tenantType">
        <el-select v-model="queryParams.tenantType" placeholder="请选择商户类型" filterable clearable size="small">
          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.app_tenant_type)"
                     :key="dict.value" :label="dict.label" :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="商户名称" prop="tenantId">
        <el-select v-model="queryParams.tenantId" @change="chooseTenant" filterable clearable placeholder="请输入商户名称"
                   @keyup.enter.native="handleQuery"
        >
          <el-option v-for="tenant in tenants" :key="parseInt(tenant.id)" :label="tenant.name"
                     :value="parseInt(tenant.id)"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="分公司名称" prop="subTenantId">
        <el-select v-model="queryParams.subTenantId" @change="chooseSubTenant" filterable clearable
                   placeholder="请输入分公司名称"
                   @keyup.enter.native="handleQuery"
        >
          <el-option v-for="subTenant in subTenants" :key="parseInt(subTenant.id)" :label="subTenant.name"
                     :value="parseInt(subTenant.id)"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="门店名称" prop="shopId">
        <el-select v-model="queryParams.shopId" filterable clearable placeholder="请输入门店名称"
                   @keyup.enter.native="handleQuery"
        >
          <el-option v-for="shop in shops" :key="parseInt(shop.id)" :label="shop.name"
                     :value="parseInt(shop.id)"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="订单类型" prop="merchantType">
        <el-select v-model="queryParams.merchantType" placeholder="请选择订单类型"
                   filterable clearable size="small"
        >
          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.app_merchant_type)"
                     :key="dict.value" :label="dict.label" :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="订单号" prop="merchantOrderNo">
        <el-input v-model="queryParams.merchantOrderNo" placeholder="请输入订单号" clearable
                  @keyup.enter.native="handleQuery"
        />
      </el-form-item>


      <el-form-item label="京东物流运单号" prop="orderAddress" label-width="120px">
        <el-input v-model="queryParams.orderAddress" placeholder="请输入京东物流运单号" clearable
                  @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="京东物流订单号" prop="orderCode" label-width="120px">
        <el-input v-model="queryParams.orderCode" placeholder="请输入京东物流订单号" clearable
                  @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="订单状态" prop="merchantStatus">
        <el-select v-model="queryParams.merchantStatus" placeholder="请选择订单状态"
                   filterable clearable size="small"
        >
          <el-option v-for="dict in this.getDictDatas(DICT_TYPE.app_merchant_status)"
                     :key="dict.value" :label="dict.label" :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="员工名称" prop="shopUserName">
        <el-input v-model="queryParams.shopUserName" placeholder="请输入员工名称" clearable @keyup.enter.native="handleQuery"/>
      </el-form-item>

      <el-form-item label="确认时间" prop="verifyTime">
        <el-date-picker v-model="queryParams.verifyTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
                        type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
                        :default-time="['00:00:00', '23:59:59']"
        />
      </el-form-item>

      <el-form-item label="订单时间" prop="merchantOrderTime">
        <el-date-picker v-model="queryParams.merchantOrderTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
                        type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
                        :default-time="['00:00:00', '23:59:59']"
        />
      </el-form-item>
      <el-form-item label="完成时间" prop="completionTime">
        <el-date-picker v-model="queryParams.completionTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
                        type="daterange"
                        range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
                        :default-time="['00:00:00', '23:59:59']"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                   :loading="exportLoading"
                   v-hasPermi="['pekingfish:app-merchant-order:export']"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" border :max-height="tableHeight" :data="list">
      <el-table-column label="操作" align="center" width="100" fixed="left" class-name="small-padding fixed-width">
        <template v-slot="scope">
          <el-button v-if="scope.row.merchantStatus === 1" size="mini" type="text" icon="el-icon-edit"
                     @click="handleNotDelivered(scope.row,scope.index)"
                     v-hasPermi="['pekingfish:app-merchant-order:notDelivered']"
          >取消发货
          </el-button>
          <el-button v-if="scope.row.merchantStatus === 2&&scope.row.payStatus === 1" size="mini" type="text"
                     icon="el-icon-edit"
                     @click="handleConfirmReceipt(scope.row,scope.index)"
                     v-hasPermi="['pekingfish:app-merchant-order:confirmReceipt']"
          >确认收货
          </el-button>
          <el-button v-if="scope.row.merchantStatus === 3 && scope.row.merchantType === 20&&scope.row.payStatus === 1"
                     size="mini" type="text"
                     icon="el-icon-edit"
                     @click="handleDeductPoints(scope.row,scope.index)"
                     v-hasPermi="['pekingfish:app-merchant-order:deductPoints']"
          >扣积分
          </el-button>

          <el-button v-if="scope.row.merchantStatus === 3 && scope.row.merchantType === 20&&scope.row.payStatus === 1"
                     size="mini" type="text"
                     icon="el-icon-edit"
                     @click="handleDeductMoney(scope.row,scope.index)"
                     v-hasPermi="['pekingfish:app-merchant-order:deductMoney']"
          >扣款
          </el-button>

          <el-button v-if="scope.row.merchantStatus === 3 && scope.row.merchantType === 20&&scope.row.payStatus === 1"
                     size="mini" type="text"
                     icon="el-icon-edit"
                     @click="handleRefundAndReturn(scope.row,scope.index)"
                     v-hasPermi="['pekingfish:app-merchant-order:refundAndReturn']"
          >退款退货
          </el-button>


          <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row,scope.index)"
                     v-hasPermi="['pekingfish:app-merchant-order:detail']"
          >订单详细
          </el-button>
        </template>
      </el-table-column>
      <el-table-column label="自增主键" v-if="false" align="center" prop="id"/>
      <el-table-column label="订单号" align="center" prop="merchantOrderNo" width="150" fixed="left"/>
      <el-table-column label="员工等级" align="center" prop="grade">
        <template v-slot="scope">
          <dict-tag :type="DICT_TYPE.app_grade" :value="scope.row.grade"/>
        </template>
      </el-table-column>
      <el-table-column label="员工名称" align="center" prop="shopUserName"/>
      <el-table-column label="商户类型" align="center" prop="accountType">
        <template v-slot="scope">
          <dict-tag :type="DICT_TYPE.app_account_type" :value="scope.row.accountType"/>
        </template>
      </el-table-column>

      <el-table-column label="订单状态" align="center" prop="merchantStatus">
        <template v-slot="scope">
          <dict-tag :type="DICT_TYPE.app_merchant_status" :value="scope.row.merchantStatus"/>
        </template>
      </el-table-column>
      <el-table-column label="订单类型" align="center" prop="merchantType">
        <template v-slot="scope">
          <dict-tag :type="DICT_TYPE.app_merchant_type" :value="scope.row.merchantType"/>
        </template>
      </el-table-column>
      <el-table-column label="支付状态" align="center" prop="payStatus">
        <template v-slot="scope">
          <dict-tag :type="DICT_TYPE.app_pay_status" :value="scope.row.payStatus"/>
        </template>
      </el-table-column>
      <el-table-column label="手机品牌" align="center" prop="brand"/>
      <el-table-column label="手机型号" align="center" prop="model"/>
      <el-table-column label="imei" align="center" prop="imei"/>
      <el-table-column label="型号类型" align="center" prop="modelType"/>
      <el-table-column label="平台报价" align="center" prop="offerPrice"/>
      <el-table-column label="额外金额" align="center" prop="extraPrice"/>
      <el-table-column label="用户改价" align="center" prop="changePrice"/>
      <el-table-column label="回收价" align="center" prop="recovery"/>
      <el-table-column label="扣款金额" align="center" prop="buckleMoney"/>
      <el-table-column label="最终回收价" align="center" prop="ultimatelyRecovery"/>
      <el-table-column label="京东物流运单号" align="center" prop="orderAddress"/>
      <el-table-column label="京东物流订单号" align="center" prop="orderCode"/>
      <el-table-column label="门店名称" align="center" prop="shopName"/>
      <el-table-column label="门店店长" align="center" prop="shopNameUserName"/>
      <el-table-column label="分公司名称" align="center" prop="subTenantName"/>
      <el-table-column label="商户名称" align="center" prop="tenantName"/>
      <el-table-column label="订单时间" align="center" prop="merchantOrderTime" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.merchantOrderTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="确认时间" align="center" prop="verifyTime" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.verifyTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="付款时间" align="center" prop="payTime" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.payTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="收货时间" align="center" prop="receivingTime" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.receivingTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="完成时间" align="center" prop="completionTime" width="180">
        <template v-slot="scope">
          <span>{{ parseTime(scope.row.completionTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="物流单号" align="center" prop="trackingNumber"/>
      <el-table-column label="审核备注" align="center" prop="checkRemark"/>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"
    />

    <!-- 订单详情 -->
    <el-dialog title="订单详情" :visible.sync="openDetail" width="800px" append-to-body>
      <el-form ref="form" :model="form" label-width="100px" size="mini">
        <el-row>
          <el-col :span="30">
            <el-form-item label="品牌：">{{ form.brand }}</el-form-item>
          </el-col>
          <el-col :span="30">
            <el-form-item label="手机型号：">{{ form.model }}</el-form-item>
          </el-col>
          <el-col :span="30">
            <el-form-item label="型号类型：">{{ form.modelType }}</el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="IMEI：">{{ form.imei }}</el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="参数：">{{ form.memory }}，{{ form.colour }}，{{ form.buy }}，{{
                form.network
              }}
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="机况：">{{ form.subrackDesc }}</el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="图片：">
              <imageUpload v-model="form.reportImg"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="openDetail = false">关 闭</el-button>
      </div>
    </el-dialog>

    <!-- 扣积分 -->
    <el-dialog :title="title" :visible.sync="openDeductPoints" width="800px" v-dialogDrag append-to-body>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormDeductPoints">确 定</el-button>
        <el-button @click="cancelDeductPoints">取 消</el-button>
      </div>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="扣除积分" prop="deductPoints">
          <el-input-number v-model="form.deductPoints" :min="0"></el-input-number>
        </el-form-item>
        <el-form-item label="员工可用积分：">{{ form.updShopUserIntegrals }}</el-form-item>
        <el-form-item label="子公司可用积分：">{{ form.updSubTenantIntegrals }}</el-form-item>
        <el-form-item label="员工本单积分：">{{ form.shopUserIntegral }}</el-form-item>
        <el-form-item label="子公司本单积分：">{{ form.subTenantIntegral }}</el-form-item>
        <el-form-item label="扣积分原因" prop="buckleReason">
          <el-input type="textarea" v-model="form.buckleReason" placeholder="请输入扣款原因"/>
        </el-form-item>
        <el-form-item label="扣积分凭证图片" prop="buckleImg">
          <imageUpload v-model="form.buckleImg" :value="form.buckleImg" :limit="10" class="mall-image"/>
        </el-form-item>

        <el-form-item label="扣积分凭证视频" prop="buckleVideo">
          <VideoUpload v-model="form.buckleVideo" :value="form.buckleVideo"/>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 扣款 -->
    <el-dialog :title="title" :visible.sync="openDeductMoney" width="800px" v-dialogDrag append-to-body>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormDeductMoney">确 定</el-button>
        <el-button @click="cancelDeductMoney">取 消</el-button>
      </div>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="子公司可用分润：">{{ form.shopUserPricesVues }}</el-form-item>
        <el-form-item label="子公司本单分润：">{{ form.subTenantPrice }}</el-form-item>
        <el-form-item label="店员本单分润：">{{ form.shopUserPrice }}</el-form-item>
        <el-form-item label="扣款金额" prop="buckleMoney">
          <el-input-number v-model="form.buckleMoney" :min="0" :precision="2"></el-input-number>
        </el-form-item>
        <el-form-item label="扣款原因" prop="buckleReason">
          <el-input type="textarea" v-model="form.buckleReason" placeholder="请输入扣款原因"/>
        </el-form-item>
        <el-form-item label="扣款凭证图片" prop="buckleImg">
          <imageUpload v-model="form.buckleImg" :value="form.buckleImg" :limit="10" class="mall-image"/>
        </el-form-item>

        <el-form-item label="扣款凭证视频" prop="buckleVideo">
          <VideoUpload v-model="form.buckleVideo" :value="form.buckleVideo"/>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 退款退货 -->
    <el-dialog :title="title" :visible.sync="openRefundAndReturn" width="800px" v-dialogDrag append-to-body>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormRefundAndReturn">确 定</el-button>
        <el-button @click="cancelRefundAndReturn">取 消</el-button>
      </div>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="回收价：">{{ form.recovery }}</el-form-item>
        <el-form-item label="本单分润：">{{ form.priceTotal }}</el-form-item>
        <el-form-item label="本单积分：">{{ form.integralTotal }}</el-form-item>
        <el-form-item label="退款金额" prop="buckleMoney">
          <el-input-number v-model="form.buckleMoney" :min="form.recovery"
                           :precision="2"
                           :value="form.recovery"
          ></el-input-number>
        </el-form-item>
        <el-form-item label="扣款原因" prop="buckleReason">
          <el-input type="textarea" v-model="form.buckleReason" placeholder="请输入扣款原因"/>
        </el-form-item>
        <el-form-item label="扣款凭证图片" prop="buckleImg">
          <imageUpload v-model="form.buckleImg" :value="form.buckleImg" :limit="10" class="mall-image"/>
        </el-form-item>

        <el-form-item label="扣款凭证视频" prop="buckleVideo">
          <VideoUpload v-model="form.buckleVideo" :value="form.buckleVideo"/>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import {
  deleteAppMerchantOrder,
  getAppMerchantOrder,
  getAppMerchantOrderPage,
  exportAppMerchantOrderExcel, confirmReceipt, deductPoints, deductMoney, refundAndReturn, notDelivered
} from '@/api/pekingfish/appMerchantOrder'
import { getBusinessList } from '@/api/merchantManagement/business'
import { getBranchCompanyByTenantId } from '@/api/merchantManagement/branchCompany'
import { getStoreBySuTenantId } from '@/api/merchantManagement/store'
import ImageUpload from '@/components/ImageUpload'
import ImagePreview from '@/components/ImagePreview'
import VideoUpload from '@/components/VideoUpload'
import Editor from '@/components/Editor'

export default {
  name: 'AppMerchantOrder',
  components: {
    VideoUpload, Editor,
    ImageUpload, ImagePreview
  },
  data() {
    return {
      tableHeight: document.documentElement.scrollHeight - 245 + 'px',
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 商户单列表
      list: [],
      // 商户名称
      tenants: [],
      // 分公司名称
      subTenants: [],
      //门店名称
      shops: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      openDeductPoints: false,
      openDeductMoney: false,
      openRefundAndReturn: false,
      openDetail: false,
      // 查询参数
      queryParams: {
        pageNo: 1,
        pageSize: 10,
        offerPrice: null,
        changePrice: null,
        recovery: null,
        buckleMoney: null,
        deductPoints: null,
        ultimatelyRecovery: null,
        merchantOrderNo: null,
        merchantType: null,
        merchantStatus: null,
        payStatus: null,
        createTime: [],
        merchantOrderTime: [],
        verifyTime: [],
        payTime: [],
        receivingTime: [],
        trackingNumber: null,
        checkStatus: null,
        checkRemark: null,
        shopUserName: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        merchantOrderNo: [{ required: true, message: '订单号不能为空', trigger: 'blur' }],
        merchantStatus: [{ required: true, message: '订单状态channelOrderTime不能为空', trigger: 'blur' }],
        payStatus: [{ required: true, message: '支付状态不能为空', trigger: 'blur' }]
      }
    }
  },
  created() {
    this.getList()
    // 商户名称
    getBusinessList().then(response => {
      this.tenants = response.data.list
    })
  },
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true
      // 执行查询
      getAppMerchantOrderPage(this.queryParams).then(response => {
        this.list = response.data.list
        this.total = response.data.total
        this.loading = false
      })
    },
    chooseTenant(tenantId) {
      console.log(tenantId + '获取的id')
      // 分公司名称
      getBranchCompanyByTenantId(tenantId).then(response => {
        this.subTenants = response.data
      })
    },

    chooseSubTenant(subTenantId) {
      console.log(subTenantId + '获取的id')
      // 门店名称
      getStoreBySuTenantId(subTenantId).then(response => {
        this.shops = response.data
      })
    },
    /** 取消按钮 */
    cancel() {
      this.open = false
      this.reset()
    },
    /** 扣积分取消按钮 */
    cancelDeductPoints() {
      this.openDeductPoints = false
      this.reset()
    },

    /** 扣款取消按钮 */
    cancelDeductMoney() {
      this.openDeductMoney = false
      this.reset()
    },

    /** 退款退货取消按钮 */
    cancelRefundAndReturn() {
      this.openRefundAndReturn = false
      this.reset()
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        offerPrice: undefined,
        changePrice: undefined,
        recovery: undefined,
        buckleMoney: undefined,
        ultimatelyRecovery: undefined,
        merchantOrderNo: undefined,
        merchantType: undefined,
        merchantStatus: undefined,
        payStatus: undefined,
        merchantOrderTime: undefined,
        verifyTime: undefined,
        payTime: undefined,
        receivingTime: undefined,
        trackingNumber: undefined,
        checkStatus: undefined,
        checkRemark: undefined
      }
      this.resetForm('form')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1
      this.getList()
    },
    /** 详细按钮操作 */
    handleView(row) {
      this.openDetail = true
      this.form = row
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.handleQuery()
    },

    handleConfirmReceipt(row) {
      const merchantOrderNo = row.merchantOrderNo
      this.$modal.confirm('是否确认同意订单编号为"' + merchantOrderNo + '"的数据收货?').then(function() {
        return confirmReceipt(row.id)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('收货成功')
      }).catch(() => {
      })
    },

    handleNotDelivered(row) {
      const merchantOrderNo = row.merchantOrderNo
      this.$modal.confirm('是否确认同意订单编号为"' + merchantOrderNo + '"的数据取消?').then(function() {
        return notDelivered(row.id)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('取消成功')
      }).catch(() => {
      })
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = '添加商户单'
    },
    /** 扣积分操作 */
    handleDeductPoints(row) {
      this.reset()
      const id = row.id
      getAppMerchantOrder(id).then(response => {
        this.form = response.data
        this.openDeductPoints = true
        this.title = '扣积分'
      })
    },

    /** 扣款操作 */
    handleDeductMoney(row) {
      this.reset()
      const id = row.id
      getAppMerchantOrder(id).then(response => {
        this.form = response.data
        this.openDeductMoney = true
        this.title = '扣款'
      })
    },

    /** 退款退货操作 */
    handleRefundAndReturn(row) {
      this.reset()
      const id = row.id
      getAppMerchantOrder(id).then(response => {
        this.form = response.data
        this.openRefundAndReturn = true
        this.title = '退款退货'
      })
    },
    /** 扣积分提交按钮 */
    submitFormDeductPoints() {
      this.$refs['form'].validate(valid => {
        if (!valid) {
          return
        }
        deductPoints(this.form).then(response => {
          this.$modal.msgSuccess('扣积分成功')
          this.openDeductPoints = false
          this.getList()
        })

      })
    },
    /** 退款提交按钮 */
    submitFormDeductMoney() {
      this.$refs['form'].validate(valid => {
        if (!valid) {
          return
        }
        deductMoney(this.form).then(response => {
          this.$modal.msgSuccess('扣款成功')
          this.openDeductMoney = false
          this.getList()
        })

      })
    },

    /** 退款退货提交按钮 */
    submitFormRefundAndReturn() {
      this.$refs['form'].validate(valid => {
        if (!valid) {
          return
        }
        refundAndReturn(this.form).then(response => {
          this.$modal.msgSuccess('退款退货成功')
          this.openRefundAndReturn = false
          this.getList()
        })

      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const id = row.id
      this.$modal.confirm('是否确认删除商户单编号为"' + id + '"的数据项?').then(function() {
        return deleteAppMerchantOrder(id)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('删除成功')
      }).catch(() => {
      })
    },

    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      let params = { ...this.queryParams }
      params.pageNo = undefined
      params.pageSize = undefined
      this.$modal.confirm('是否确认导出所有商户单数据项?').then(() => {
        this.exportLoading = true
        return exportAppMerchantOrderExcel(params)
      }).then(response => {
        this.$download.excel(response, '商户单.xls')
        this.exportLoading = false
      }).catch(() => {
      })
    }
  }
}
</script>
